package iu.hib.bean;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

@ManagedBean(name="bookBean")
@SessionScoped

@Entity
@Table(name = "books")
public class Book {

	private Long id;
	private String title;
	private String isbn;

	public Book() {
		// default constructor
	}

	@Id
	@GeneratedValue
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getIsbn() {
		return isbn;
	}

	@Column(unique = true)
	public void setIsbn(String isbn) {
		this.isbn = isbn;
	}

	public String toString() {
		return "[" + id + "] " + title + ", ISBN: " + isbn;
	}
}
